package com.hd.sup.modules.enterprise.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.hd.common.utils.GenUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author chentl123
 * @since 2020-12-28
 */
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("sp_enterprise")
public class Enterprise extends Model<Enterprise> {

    private static final long serialVersionUID = 1L;

    //企业列表查询构造
    public Enterprise(String name, String region) {
        this.name = name;
        this.region = region;
    }

    //插入构造
    public Enterprise(String enterpriseNo, String name, String industry, String region, String contactor, String contactorPhone, String issueOffice, String address,  String parentId) {
        this.id = GenUtil.newId();
        this.enterpriseNo = enterpriseNo;
        this.name = name;
        this.industry = industry;
        this.region = region;
        this.contactor = contactor;
        this.contactorPhone = contactorPhone;
        this.issueOffice = issueOffice;
        this.address = address;
        this.parentId = parentId;
    }

    /**
     * 企业id
     */
    private String id;
    /**
     * 企业编号|企业唯一
     */
    @TableField("enterprise_no")
    private String enterpriseNo;
    /**
     * 企业名称
     */
    private String name;
    /**
     * 所属行业
     */
    private String industry;
    /**
     * 所属区域
     */
    private String region;
    /**
     * 联系人
     */
    private String contactor;
    /**
     * 联系人电话
     */
    @TableField("contactor_phone")
    private String contactorPhone;
    /**
     * 核发机关名称
     */
    @TableField("issue_office")
    private String issueOffice;
    /**
     * 企业地址
     */
    private String address;
    /**
     * 创建人
     */
    @TableField("create_by")
    private String createBy;
    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;
    /**
     * 更新时间
     */
    @TableField("update_time")
    private Date updateTime;
    /**
     * 更新人
     */
    @TableField("update_by")
    private String updateBy;
    /**
     * 组织机构id
     */
    @TableField("dept_id")
    private String deptId;
    /**
     * 父级id
     */
    @TableField(exist = false)
    private String parentId;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
